<extend name="common" />
<block name="main">
<div class="bd">
    <div class="api-groups col-lg-2 pd-none">
        <ul class="nav nav-pills nav-stacked">
            <empty name="active_filter['group_id']">
            <li class="active"><a href="{:U('Home/Project/apiList',['pid'=>$project_id])}">所有接口&nbsp<span class="badge">{$api_count}</span></a></li>
            <else />
            <li><a href="{:U('Home/Project/apiList',['pid'=>$project_id])}">所有接口&nbsp<span class="badge">{$api_count}</span></a></li>
            </empty>
            <foreach name="groups" item="group">
            <if condition = "$active_filter['group_id'] eq $group['group_id']">
            <li class="active"><a href="{:U('Home/Project/apiList',['pid'=>$project_id,'gid'=>$group['group_id']])}">{$group['group_name']}&nbsp<span class="badge">{$group['count']}</span></a></li>
            <else />
            <li><a href="{:U('Home/Project/apiList',['pid'=>$project_id,'gid'=>$group['group_id']])}">{$group['group_name']}&nbsp<span class="badge">{$group['count']}</span></a></li>
            </if>
            </foreach>
        </ul>
    </div>
    <div class="api-lists col-lg-10">
        <table class="table table-striped table-apilist">
            <thead>
                <tr>
                    <td colspan="2">
                    <form class="navbar-form navbar-left" role="search" data-ajax="false" action="{:U(Home/Project/ApiList,['pid'=>$project_id,'gid'=>$active_filter['group_id']])}" method="post">
                        <input type="hidden" name="gid" value="{$active_filter['group_id']}">
                        <input type="hidden" name="pid" value="{$project_id}">
                        <div class="form-group">
                            <input type="text" name="search_keyword" class="form-control" placeholder="搜索接口" value="{$active_filter['search_keyword']}">
                        </div>
                        <button type="submit" class="btn btn-default">搜索</button>
                    </form>
                    </td>
                    <td class="export">
                        <a href="/apitester/index.php/Home/Project/exportTxt/pid/{$project_id}/gid/{$active_filter['group_id']}.html" id="export_txt" class="btn btn-default">导出TXT文档</a>
                    </td>
                </tr>
            </thead>
            <tbody>
                <foreach name="apis" item="api">
                <tr>
                    <td class="col-lg-3"><span class="label label-success">{$api.api_method|strtoupper}</span>&nbsp{$api.api_name}</td>
                    <td class="col-lg-4">{$api.api_intro}</td>
                    <td class="col-lg-5">
                        <a class="btn btn-xs btn-warning btn-test" target="_blank" href="{:U('Home/Project/testApi',['pid'=>$project_id,'aid'=>$api[api_id]])}"><i class="glyphicon glyphicon-paperclip"></i>&nbsp;测试</a>
                        <a class="btn btn-xs  btn-default btn-detail" href="{:U('Home/Project/apiDetail',['pid'=>$project_id,'aid'=>$api[api_id]])}"><i class="glyphicon glyphicon-eye-open"></i>&nbsp;详情</a>
                        <if condition="$self_auth neq 'tour'">
                        <a class="btn btn-xs btn-primary btn-copy" href="{:U('Home/Project/addApi',['pid'=>$project_id,'aid'=>$api[api_id]])}"><i class="glyphicon glyphicon-file"></i>&nbsp;复制</a>
                        <a class="btn btn-xs btn-info btn-edit" href="{:U('Home/Project/editApi',['pid'=>$project_id,'aid'=>$api[api_id]])}"><i class="glyphicon glyphicon-pencil"></i>&nbsp;修改</a>
                        <a class="btn btn-xs btn-danger btn-delete" href="javascript:;" onclick="deleteApi({$api[api_id]})"><i class="glyphicon glyphicon-remove"></i>&nbsp;&nbsp;删除</a>
                        </if>
                    </td>
                </tr>
                </foreach>
            </tbody>
        </table>
        <ul class="pagination pull-right">
            <if condition="$page['current'] eq 1">
            <li class="disabled"><a href="javascript:;">&laquo;</a></li>
            <else />
            <li><a href="{:U('Home/Project/apiList',['pid'=>$project_id,'gid'=>$active_filter['group_id'],'page_no'=>$page['current']-1])}">&laquo;</a></li>
            </if>
            <for start="1" end="$page['count'] + 1" step="1" name="page_no" >
            <if condition="$page_no eq $page['current']">
            <li class="active"><a href="{:U('Home/Project/apiList',['pid'=>$project_id,'gid'=>$active_filter['group_id'],'page_no'=>$page_no])}">{$page_no}</a></li>
            <else />
            <li><a href="{:U('Home/Project/apiList',['pid'=>$project_id,'gid'=>$active_filter['group_id'],'page_no'=>$page_no])}">{$page_no}</a></li>
            </if>
            </for>
            <if condition="$page['current'] egt $page['count']">
            <li class="disabled"><a href="javascript:;">&raquo;</a></li>
            <else />
            <li><a href="{:U('Home/Project/apiList',['pid'=>$project_id,'gid'=>$active_filter['group_id'],'page_no'=>$page['current']+1])}">&raquo;</a></li>
            </if>
        </ul>
    </div>
</div>
</block>